<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>js 分支 循环 数组 函数</title>
		<script>
			//1.分支 判断: 整数 成绩 年份 星期
			var a = 1;
			if ((a = prompt("请输入整数")) > 10) {
				console.log("a:::" + a);
			} else {
				console.log("a:::" + "小于十");
			}
			if (a >= 60 && a < 80) {
				console.log("中等");
			} else if (a >= 80 && a <= 100) {
				console.log("优秀")
			} else if (a >= 0 && a < 60) {
				console.log("不及格");
			} else {
				console.log("输入有误！");
			}


			//2.循环 1-10 1-10的和 花钱
			for (var i = 1; i <= 10; i++) {
				console.log(i);
			}
			var sum = 0;
			for (var i = 1; i <= 10; i++) {
				sum += i;
			}
			console.log(sum);
			sum = 0;
			var num1 = 100000000;
			while (num1 > 0) {
				num1 -= 5000000;
				sum++;
			}
			console.log(sum);
			sum = 0;
			num1 = 100000000;
			while (num1 > 1) {
				num1 /= 2;
				sum++;
			}
			console.log(sum);

			//3.数组 创建 赋值 长度
			var ar0 = [];
			var ar1 = new Array();
			ar1 = [1, 1.1, null, undefined, false, "???S"];
			for (var i in ar1) {
				console.log(ar1[i]);
			}

			//4.函数 创建 含参无参多参 重载
			function fn() {
				console.log("1");
			}
			var fn = function() {}
			var fn = function(a, b) {}
			var fn = function(a) {
				return a;
			}
		</script>
	</head>
	<body>
	</body>
</html>
